#include"Sort.h"

//void SortTeat()
//{
//	int a[] = { 8, 2, 5, 4, 9, 6, 3, 7 };
//	//InsertSort(arr,sizeof(arr)/sizeof(int));
//	//ShallSort(arr, sizeof(arr) / sizeof(int));
//	int n = sizeof(a) / sizeof(int);
//	//SelectSort(arr, n);
//	QuickSort(a, 0, n - 1);
//	Print( a, n);
//}
#define N 10000000
void QuickSortTest()
{
	int* a1 = (int*)malloc(sizeof(int) * N);
	if (a1 == NULL)
	{
		perror("malloc fail");
		return;
	}
	int* a2 = (int*)malloc(sizeof(int) * N);
	if (a2 == NULL)
	{
		perror("malloc fail");
		return;
	}


	for (int i = 0; i < N; i++)
	{
		a1[i] = a2[i] = rand() + i;
	}
	int begin1 = clock();
	QuickSort(a1, 0, N - 1);
	int end1 = clock();

	int begin2 = clock();
	ShallSort(a2, N);
	int end2 = clock();

	printf("QuickSort: %d\n", end1 - begin1);
	printf("ShallSort: %d\n", end2 - begin2);

}

void test1()
{
	int a[] = { 8,5,9,7,8,3,6,2,1 };
	MergeSortNonR(a, 9);
	Print(a,9);
}
int main()
{
	//SortTeat();
	srand((size_t)time(NULL));
	//QuickSortTest();
	test1();
	return 0;
}